package dynamicPlan;

public class lengthSub {
    public int lengthOfLIS(int[] nums){
        if (nums.length<=1){
            return 1;
        }
        int[]dp=new int[nums.length];
        for (int i=0;i<dp.length;i++){
            dp[i]=1;
            for (int j=0;j<i;j++){
                if (nums[j]<nums[i]){
                    dp[i]=maxNum(dp[j]+1,dp[i]);
                }
            }
        }
        int temp=dp[0];
        for (int j=1;j<dp.length;j++){
            if (dp[j]>temp){
                temp=dp[j];
            }
        }
        System.out.println(temp);
        return temp;
    }
    public static int maxNum(int a,int b){
        if (a<b){
            return b;
        }
        else{
            return a;
        }
    }

    public static void main(String[] args) {
        int[]nums={9,-1,6,8,2,7,4,3,0,-6,9};
        lengthSub length=new lengthSub();
        length.lengthOfLIS(nums);
    }
}
